UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8P8jRWSQk3z/OgzVdVymJG0bW1piaV8SKj3ZE2JuNWw='
WHERE
key_id = '2041385c6009a14a23059d71a59e7bb82798fa45d304ade243b6dda9ca99fe9c'
AND (
token = '8P8jRWSQk3z/OgzVdVymJG0bW1piaV8SKj3ZE2JuNWw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)