UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XB7dUlBUYavyYgjsfTS7OEZCzOU3jQIYCyTwdE+rAno='
WHERE
key_id = '2d9cf8eaacd41c1467a29c65f708840a1b298bb8380c62885c677003043f15d1'
AND (
token = 'XB7dUlBUYavyYgjsfTS7OEZCzOU3jQIYCyTwdE+rAno='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)