UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M2xTPSwpE+ffl7PMplJ2M0GIUeCaHHbrGu2a7Lfh8UU=' 
WHERE 
  key_id = 'f168c5ee1b255fde7bd2973d82e6ffac6096f5bec9284522b8c7497eb93e3338' 
  AND (
    token = 'M2xTPSwpE+ffl7PMplJ2M0GIUeCaHHbrGu2a7Lfh8UU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041