UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8JKKBBfeZwvVlRr8KiAqhU57B0GvaHkvPXcJ8sPLX7o='
WHERE
key_id = '5702bce6893fb56984d2b9c47b289bf04a6ced6af81c281af9a2f44ff34a6640'
AND (
token = '8JKKBBfeZwvVlRr8KiAqhU57B0GvaHkvPXcJ8sPLX7o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)