UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sX+hl5GspbpOEys6NS6TVkRSes44/6xmyzuWeJCsVXc=' 
WHERE 
  key_id = '88b3d7d1ba8b96e2bb8180153a1f5db868226f1603a9c815e9a52c0174cc51e4' 
  AND (
    token = 'sX+hl5GspbpOEys6NS6TVkRSes44/6xmyzuWeJCsVXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048