UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iTiDz928BbxYgFutc21tS2B1Bf7GhEzO9YSU1ejy7Ng=' 
WHERE 
  key_id = '4d4309302f35434f9854709ed95b0be732e815b7cdeb26ca3e9f5e45e697c66d' 
  AND (
    token = 'iTiDz928BbxYgFutc21tS2B1Bf7GhEzO9YSU1ejy7Ng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036