UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'to8NCgkkiJxsmtodbSkiKi/JqClSyKLSETCN3VHaF/U='
WHERE
key_id = '6a76cf63eddbcfd241283969b37aba3e051fe34ef6806fbc28df634de39563f2'
AND (
token = 'to8NCgkkiJxsmtodbSkiKi/JqClSyKLSETCN3VHaF/U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)