UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qFsYjkSzG4RnDMNiB91Q9MZoRbCF6Bt2CsCfMc1Qot4='
WHERE
key_id = '32f73e479339f09cbf3c8d63b3cd48c3b8b5c3683c93723874d6338307a1464d'
AND (
token = 'qFsYjkSzG4RnDMNiB91Q9MZoRbCF6Bt2CsCfMc1Qot4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)