UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Waj9Bq/IlVLzcFzzOETdVNNm1IQ4gwuSJKdF2PZ/LOg=' 
WHERE 
  key_id = 'f37310884e21895c42f0af65652558b2758cd13164286d65d57ca19d84475937' 
  AND (
    token = 'Waj9Bq/IlVLzcFzzOETdVNNm1IQ4gwuSJKdF2PZ/LOg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020