UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k7gE72tlff4b3jNctS7JrVjRSwvOrcT77dR2iv20tDk=' 
WHERE 
  key_id = '34957f0ceedcf21f3704e0b1f2e6ffdff1dd72de38796e8522ddb95cf0b1b622' 
  AND (
    token = 'k7gE72tlff4b3jNctS7JrVjRSwvOrcT77dR2iv20tDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028