UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wy1NAfu9J0lwILc8F+z7eKDr+IeBf0hZFf3N5ygRu9c=' 
WHERE 
  key_id = '4f224de9752a634153468ef0d8bc7de4429d40b68018bcaf2883a8b89c31485d' 
  AND (
    token = 'wy1NAfu9J0lwILc8F+z7eKDr+IeBf0hZFf3N5ygRu9c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029