UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2WXonDIjin7GGniTe6ie0aaR1cJlol5341Wj+Ttyp1k=' 
WHERE 
  key_id = 'de4663bd4cd4a61aaedc54c760902902b73acea69088f75162ea3ec3cc200865' 
  AND (
    token = '2WXonDIjin7GGniTe6ie0aaR1cJlol5341Wj+Ttyp1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018