UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's8hNXLyBKLrMORzyyKuvcmggtraBoiDnNmdQi4vSSIA='
WHERE
key_id = '97e8eb6ce2b9dccf961780941ca23d6934a84a02efff2d863ff24c355a5f5f39'
AND (
token = 's8hNXLyBKLrMORzyyKuvcmggtraBoiDnNmdQi4vSSIA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)