UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j8NY00lnAS+is07kyTHkEVUaue0QbwJaMX9weQd0HlY='
WHERE
key_id = 'a9fee241dbd807a53dbe406e8ac4aa8aab7875ab1e872f8ba4ea49e2a81b9ea1'
AND (
token = 'j8NY00lnAS+is07kyTHkEVUaue0QbwJaMX9weQd0HlY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)