UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YC49+tgw1X1OZEq4QgXXRzumsSo0s6Z/B7yt3Hq41HE=' 
WHERE 
  key_id = 'd1dd427956545a20c79b43f37d9680ffdac8dc25aafac7c86ff9d960c524f5ab' 
  AND (
    token = 'YC49+tgw1X1OZEq4QgXXRzumsSo0s6Z/B7yt3Hq41HE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037