UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8TGq0tOBKrkJ4C23F5bWMpTWicwTTTJ49FBi1pkbPtE=' 
WHERE 
  key_id = '766748f910108d34a1309bb6c4ef0209d5c85ec01bd4014948f8e477f3e0f442' 
  AND (
    token = '8TGq0tOBKrkJ4C23F5bWMpTWicwTTTJ49FBi1pkbPtE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025