UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eTQCEtdoszM1PAze28vvn3GaCbzxIWnPVSbrzgnBYdM='
WHERE
key_id = '39b1ef6e1be01fcbac7fb370cab2b0090d71b3b8d067072a54a6d00b9e417188'
AND (
token = 'eTQCEtdoszM1PAze28vvn3GaCbzxIWnPVSbrzgnBYdM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)