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