UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FcPJJv/808AhL2U7ZiumYZkdIU177XRBhQFU6KzJkfE='
WHERE
key_id = 'a0afdbe7c6728590ee32196c995bd92092ba1b3b714a3eeb04da03e56f0545cf'
AND (
token = 'FcPJJv/808AhL2U7ZiumYZkdIU177XRBhQFU6KzJkfE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)