UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QLZN/8UA9QmetwC1S5K0tQk7gUCoPx5WFNKxXnAhw48=' 
WHERE 
  key_id = '16727b7b42f105a570930d880f2c7ff8508a4d84e549cf094044ea652be468ab' 
  AND (
    token = 'QLZN/8UA9QmetwC1S5K0tQk7gUCoPx5WFNKxXnAhw48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029