UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gcq9sv1cg3YbBTGXYu2MLFR1FByBCRlUsGwbCDpc++Y='
WHERE
key_id = 'd698c07032ca8cacbd24830f5482b60f5e6109084fee9fad90f41cbcbc60503a'
AND (
token = 'gcq9sv1cg3YbBTGXYu2MLFR1FByBCRlUsGwbCDpc++Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)