UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lSg6M44HT3dLFJcmr3J8IXOdfdqB1IpmJH/KNcIkOcE='
WHERE
key_id = 'd15963dd0cf334af8a4528ae837e275adf756a1ebf0c0a3a9b45547c5d950e44'
AND (
token = 'lSg6M44HT3dLFJcmr3J8IXOdfdqB1IpmJH/KNcIkOcE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)