UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6FZWcI5JOjot5ig6PCf/KfDDQRbcxYNH+BlCaE3vz8I='
WHERE
key_id = 'b795af3cf7032beb68297596977436a4673e934dcc982f205efd3526be4871d5'
AND (
token = '6FZWcI5JOjot5ig6PCf/KfDDQRbcxYNH+BlCaE3vz8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)