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