UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iZcntlgbAFhRClWHiPVIdoqIBVjjniJzd4U3ruGbhjc=' 
WHERE 
  key_id = '6ee834f7d9a16740493860788fcad142dd97a92014951b9fe290e56171bbddc8' 
  AND (
    token = 'iZcntlgbAFhRClWHiPVIdoqIBVjjniJzd4U3ruGbhjc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062