UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mGRYtPl/6YJsP3AmCqUxqsTqafXXSNFO7skVGe09DMY='
WHERE
key_id = '79f627f94a8a83f124f41b44d1b3c849a615961e251adbfbee36c0b4a5e16d57'
AND (
token = 'mGRYtPl/6YJsP3AmCqUxqsTqafXXSNFO7skVGe09DMY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)