UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gaqWEWWn6ARaonupsIDozkCqJU12njkd7pK1n5TQ9Uo=' 
WHERE 
  key_id = '9f86055a7544e4db03d96b2d1441a6a05b93bb82b8120af919861a245c500e38' 
  AND (
    token = 'gaqWEWWn6ARaonupsIDozkCqJU12njkd7pK1n5TQ9Uo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030