UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0uoW4vpk0nBI2lClecDNv4k7LIvP2c58iLcZkjj2zrg=' 
WHERE 
  key_id = '3825988735a062065d7ed2cdaabd5102431e9070208cc9de65cc38325a8edd49' 
  AND (
    token = '0uoW4vpk0nBI2lClecDNv4k7LIvP2c58iLcZkjj2zrg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051