UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nSOLucO2AffZ2Gz9I1k85DoGZk8PhGeWHiRPAcnMSjI=' 
WHERE 
  key_id = 'a2cd43cf1876c0a68bcdab861f8fd7e3d05f17c7668472c5afe7d72f029c441e' 
  AND (
    token = 'nSOLucO2AffZ2Gz9I1k85DoGZk8PhGeWHiRPAcnMSjI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040