UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IqJ/SLC4kVdd06quZ/msgL4R0ha9xsp1wQanf50zP7M='
WHERE
key_id = '1a3ad0375e9a471eb79ea58ff9de3f29deddb83d27f650be18b7457a253a1cfc'
AND (
token = 'IqJ/SLC4kVdd06quZ/msgL4R0ha9xsp1wQanf50zP7M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)