UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cvP1Sw+vuvIoU5uw3EgS6KJJ/Lz/kM5No29H7DaridU='
WHERE
key_id = 'af1479cfcb0577a3d2c3f83ebf483eeb40165092c7338dbdf9885b1e1c35e0cf'
AND (
token = 'cvP1Sw+vuvIoU5uw3EgS6KJJ/Lz/kM5No29H7DaridU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)