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

Query time 0.00042