UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WS9E0NTQuBHquIEASgMQt1ybI2Gg4MYoSx7u0Ma8wZ0='
WHERE
key_id = 'ab268e7afe33694ee882dff0b129955efd608a4d5462f38dd8e568b8e40030d1'
AND (
token = 'WS9E0NTQuBHquIEASgMQt1ybI2Gg4MYoSx7u0Ma8wZ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)